<?php

hc_core_ClassLoader::load('halo_AbstractView');
hc_core_ClassLoader::load('halo_UriViewHelper');

class halo_RedirectView extends halo_AbstractView {

    protected $additionalConfigurationKeys = array('site');

    public function doRender(array $model, halo_HttpRequest $httpRequest, halo_HttpResponse $httpResponse) {
        if ( $model === null ) $model = array();
        $uriViewHelper = new halo_UriViewHelper($httpRequest, $httpResponse);
        $site = $this->getAdditionalConfiguration('site');
        if ( $site ) {
            $url = $uriViewHelper->getSite($site, $this->url, $model);
        } else {
            $url = $uriViewHelper->getAbsolute($this->url, $model);
        }
        header('Location: ' . $url);
        return null;
    }

}

?>
